# encoding: utf-8

class ImagesController < ApplicationController
  
	before_filter :load_sidebar  
  before_filter :require_login
  before_filter :require_moderator
  
  def index
    @images = Image.order("created_at DESC").all
  end

  def show
    @image = Image.find( params[:id] )
  end

  def new
    @image = Image.new
  end

  def create
    image = Image.create( params[:image] )
    
    redirect_to image
  end

  def destroy
    image = Image.find( params[:id] )
    image.destroy
    
    redirect_to images_path
  end

end
